const express = require('express');
const goodsRouter = express.Router();
const SQLQuery = require('../utils/query.js');



goodsRouter.post('/mini/details', async function (req, res) {
    try {
        let queryObj = req.body;
        var sql = `select * from wx_goods where id = ${queryObj.id}`;
        let result = await SQLQuery.query(sql)
        res.send(global.common.resJson(0, 'success', result[0]))
    } catch (err) {
        res.send(err)
    }
})

goodsRouter.post('/mini/getGoodsList', async function (req, res) {
    try {
        let queryObj = req.body;
        var sql = `select * from wx_goods`;
        let result = await SQLQuery.query(sql)
        res.send(global.common.resJson(0, 'success', result))
    } catch (err) {
        res.send(err)
    }
})


goodsRouter.post('/mini/getMainly', async function (req, res) {
    try {
        let queryObj = req.body;
        var sql = `select * from wx_goods`;
        let result = await SQLQuery.query(sql)
        res.send(global.common.resJson(0, 'success', result))
    } catch (err) {
        res.send(err)
    }
})





module.exports = goodsRouter;